import React, { Component } from 'react'
import { View, Text, TouchableOpacity, ImageBackground, Platform } from 'react-native'
import { Actions } from 'react-native-router-flux'
import commonStyle from '../../libs/commonStyle'
import Iconfont from '../iconfont'

export default class HeaderTransparent extends Component {
	settingsHandle() {
		Actions.settingsIndex()
	}
	searchHandle () {
		Actions.search()
	}
	render() {
		return (
			<View
				style={[
					commonStyle.activeBackgroundColor,
					commonStyle.flexRow,
					commonStyle.flexVerticalCenter,
					Platform.OS === 'ios' ? commonStyle.h140 : commonStyle.h100,
					{ position: 'relative' }
				]}
			>
				<ImageBackground
					resizeMode="cover"
					style={[commonStyle.wp100, commonStyle.hp100]}
// 					source={{
// 						uri:
// 							'https://ojlty2hua.qnssl.com/image-1552706114433-6aG26YOo5qiq5p2hLmpwZw==.jpg'
// 					}}
					source={require('../../../assets/imgs/header.jpg')}
				>
					{/* <View
						style={[commonStyle.flexItem, commonStyle.flexCenter]}
					>
						<Text style={[commonStyle.f36, commonStyle.colorWhite]}>
							赚元宝
						</Text>
					</View> */}
					{((this.props.navigation.state.params &&
						this.props.navigation.state.params.settings) ||
						this.props.settings) && (
						<TouchableOpacity
							style={[
								commonStyle.w100,
								Platform.OS === 'ios' ? commonStyle.h140 : commonStyle.h100,
								commonStyle.mr10,
								commonStyle.flexCenter,
								{
									position: 'absolute',
									right: 0,
									zIndex: 2
								}
							]}
							activeOpacity={1}
							onPress={this.settingsHandle}
						>
							<Text
								style={[
									commonStyle.w100,
									commonStyle.textRight,
									commonStyle.colorWhite
								]}
							>
								设置
							</Text>
							{/* <Iconfont name='shezhi' size={20} color='#eee' /> */}
						</TouchableOpacity>
					)}
					{((this.props.navigation.state.params &&
						this.props.navigation.state.params.search) ||
						this.props.search) && (
						<TouchableOpacity
							style={[
								commonStyle.w100,
								Platform.OS === 'ios' ? commonStyle.h140 : commonStyle.h100,
								commonStyle.mr10,
								commonStyle.flexCenter,
								{
									position: 'absolute',
									right: 0,
									zIndex: 2
								}
							]}
							activeOpacity={1}
							onPress={this.searchHandle}
						>
							
							<Text
								style={[
									commonStyle.w100,
									commonStyle.textRight,
									commonStyle.colorWhite
								]}
							>
								<Iconfont name="search_line" size={26} />
							</Text>
							{/* <Iconfont name='shezhi' size={20} color='#eee' /> */}
						</TouchableOpacity>
					)}
				</ImageBackground>
			</View>
		)
	}
}
